package day0516.interfaceDemo;

public interface Animal {
    public abstract void eat();
    void drink();
    void sleep();
}

abstract class Pet implements Animal{//implements实现//Pet宠物 implements Animal动物接口
    String name;
    public void drink(){//方法重写:
        System.out.println(name+"在喝水");
    }
    public void sleep(){
        System.out.println(name+"在睡觉");
    }
}

class Cat extends Pet{
    Cat(String name){
        this.name=name;
    }
    public void eat(){//方法重写:
        System.out.println(name+"在吃猫粮");
    }
}






interface Plant{
    void photosynthesis();
}

class Tree implements Plant{
    public void photosynthesis(){
        System.out.println("树在 Photosynthesis");
    }
}









